package com.enlorenz.common.excel;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFDataFormat;
import org.apache.poi.hssf.usermodel.HSSFFont;

public interface PoiStyleSetter {
	
	void setHSSFCellStyle(HSSFDataFormat format,HSSFCell cell,HSSFCellStyle style,HSSFFont font);
	
	//标题
	TitilePoiStyleSetter TITLE_STYLE=new TitilePoiStyleSetter();
	//加粗居中
	BoldCenterStyleSetter BOLD_CENTER_STYLE=new BoldCenterStyleSetter();
	
	public static class BoldCenterStyleSetter implements PoiStyleSetter{

		@Override
		public void setHSSFCellStyle(HSSFDataFormat format,HSSFCell cell,HSSFCellStyle cellStyle,HSSFFont font) {
			cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 居中   
			font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);//粗体显示    
		}
		
	}
	
	public static class TitilePoiStyleSetter implements PoiStyleSetter{

		@Override
		public void setHSSFCellStyle(HSSFDataFormat format,HSSFCell cell,HSSFCellStyle cellStyle,HSSFFont font) {
			//cellStyle.setFillForegroundColor(HSSFColor.);// 设置背景色    
			//cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);    
			/*cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); //下边框    
			cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);//左边框    
			cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);//上边框    
			cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);//右边框    
*/			cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 居中   
			
			//font.setFontName("黑体");    
			//font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);//粗体显示    
			font.setFontHeightInPoints((short) 18);    
		}
		
	}
}
